package utils
{
	
	/**
	 * @author gcxk721
	 * 2012-8-30
	 * 下午1:38:47
	 */
	public class QhRectangle
	{
		
		private var m_x : int = 0;
		
		private var m_y : int = 0;
		
		private var m_width : int = 0;
		
		private var m_height : int = 0;
		
		public function QhRectangle(_x : int = 0, _y : int = 0, _width : int = 0, _height : int = 0)
		{
			m_x = _x;
			m_y = _y;
			m_width = _width;
			m_height = _height;
		}
		
		public function contains(_x : int, _y : int) : Boolean
		{
			if(m_x <= _x && _x <= (m_x + m_width))//x在范围内
			{
				if(m_y <= _y && _y <= (m_y + m_height))
				{
					return true;
				}
			}
			return false;
		}
		
		public function get x() : int
		{
			return m_x;
		}

		public function set x(value : int) : void
		{
			m_x = value % 2 == 0 ? value : ++value;
		}

		public function get y():int
		{
			return m_y;
		}

		public function set y(value:int) : void
		{
			m_y = value % 2 == 0 ? value : ++value;
		}

		public function get width():int
		{
			return m_width;
		}

		public function set width(value:int) : void
		{
			m_width = value % 2 == 0 ? value : ++value;
		}

		public function get height():int
		{
			return m_height;
		}

		public function set height(value:int) : void
		{
			m_height = value % 2 == 0 ? value : ++value;
		}

	}
}